
package org.apache.mina.common;

/**
 * An interface that builds {@link IoFilterChain} in predefined way when
 * {@link IoSession} is created. You can extract common filter chain
 * modification logic to this interface. For example, to add a filter to the
 * chain,
 * 
 * 当创建IoSession时，以预定义的方式建立IoFilterChain。你可以推导出该该接口一般的过滤链修改逻辑。比如，增加一个过滤器到过滤链：
 * 
 * <pre>
 * public class MyFilterChainBuilder implements IoFilterChainBuilder {
 *     public void buildFilterChain(IoFilterChain chain) throws Exception {
 *         chain.addLast(&quot;myFilter&quot;, new MyFilter());
 *     }
 * }
 * </pre>
 */
public interface IoFilterChainBuilder {
    /**
     * An implementation which does nothing.
     * 
     * 一个空的简单的实现类
     */
    IoFilterChainBuilder NOOP = new IoFilterChainBuilder() {
                                  public void buildFilterChain(
                                          IoFilterChain chain) throws Exception {
                                  }

                                  public String toString() {
                                      return "NOOP";
                                  }
                              };

    /**
     * Modifies the specified <tt>chain</tt>.
     * 
     * 修改指定的chain。
     */
    void buildFilterChain(IoFilterChain chain) throws Exception;
}
